/*
 * Copyright (c) 2010, Nikolaus Moll
 * All rights reserved.
 */
package net.miblounge.gradecalculator.plugin.exceptions;

@SuppressWarnings("serial")
public class PluginException extends RuntimeException {
	public PluginException(final String message, final Throwable cause)
	{
		super(message, cause);
	}

	public PluginException(final String message)
	{
		super(message);
	}

	private String getCauseText(final Throwable cause)
	{
		if (cause == null) {
			return "";
		}
		
		final String result = "\nCause: " + cause.toString();
		
		return result;
	}
	
	@Override
	public String getMessage()
	{
		return super.getMessage() + getCauseText(getCause());
	}
}
